#include <cstdint>
#include <cstdio>
#include <iostream>
#include <istream>
#include <set>
#include <utility>
#include <vector>
using ll = int64_t;

std::vector<std::set<ll>> gotopos;
std::vector<ll> endpos;
ll n,k;
std::vector<ll> poscow,nposcow;
std::vector<ll> bcj;
std::vector<std::set<ll>> ans;
static inline ll find(ll idx){
    if(idx==bcj[idx])return idx;
    return bcj[idx]=find(bcj[idx]);
}
static inline void merge(ll a,ll b){
    bcj[find(a)]=find(b);
}

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::cin>>n>>k;
    
    poscow.resize(n+1);
    gotopos.resize(n+1);
    endpos.resize(n+1);
    bcj.resize(n+1);
    for(ll i=1;i<=n;i++)bcj[i]=i;
    ans.resize(n+1);

    for(ll i=1;i<=n;i++)poscow[i]=i;
    for(ll i=1;i<=k;i++){
        ll a,b;
        std::cin>>a>>b;
        gotopos[poscow[a]].emplace(b);
        gotopos[poscow[b]].emplace(a);
        std::swap(poscow[a],poscow[b]);
    }
    for(ll i=1;i<=n;i++){
        endpos[poscow[i]]=i;
    }
    for(ll i=1;i<=n;i++)poscow[i]=i;
    for(ll i=1;i<=n;i++){
        merge(i, endpos[i]);
        if(gotopos[i].size())gotopos[i].erase(gotopos[i].find(endpos[i]));
    }
    for(ll i=1;i<=n;i++){
        ans[find(i)].emplace(i);
        ans[find(i)].insert(gotopos[i].cbegin(),gotopos[i].cend());
    }
    for(ll i=1;i<=n;i++){
        std::cout<<ans[find(i)].size()<<"\n";
    }
}